#!/usr/bin/perl

use utf8;
use strict;
use warnings;
use 5.010001;

sub divisors {
	my $number = shift;

	my @divisors = ();
	foreach my $divisor ( 2 .. ( $number/2 ) ) {
		push @divisors, $divisor unless $number % $divisor;
	}

	return @divisors;

}


while ( <> ) {
	chomp;

	given ( $_ ) {
		when ( /\A\D+\Z/ ) { say "not a number!" }

		my @divisors = divisors ( $_ );
		
		my @empty;
		when ( @divisors ~~ @empty ) { say "number is prime" }
		default { say "$_ is divisble by @divisors" }
	}
}